home *** CD-ROM | disk | FTP | other *** search
- # cvs.make
- # by Mike Ferris
- # Part of MOKit
- # Copyright 1993, all rights reserved
-
- # ABOUT MOKit
- # by Mike Ferris (mike@lorax.com)
- #
- # MOKit is a collection of useful and general objects. Permission is
- # granted by the author to use MOKit in your own programs in any way
- # you see fit. All other rights pertaining to the kit are reserved by the
- # author including the right to sell these objects as objects, as part
- # of a LIBRARY, or as SOURCE CODE. In plain English, I wish to retain
- # rights to these objects as objects, but allow the use of the objects
- # as pieces in a fully functional program. Permission is also granted to
- # redistribute the source code of MOKit for FREE as long as this copyright
- # notice is left intact and unchanged. NO WARRANTY is expressed or implied.
- # The author will under no circumstances be held responsible for ANY
- # consequences from the use of these objects. Since you don't have to pay
- # for them, and full source is provided, I think this is perfectly fair.
-
- # About cvs.make
- #
- # This file is a HACK. It is based on Art Isbell's cvs.postamble,
- # but will work for whole directory trees, not just a PB directory.
- #
- # This file provides three make targets. The first (cvsco) will look for any
- # CVS directories inside directories with one of a list of extensions
- # (ie nib and rtfd), and will tar all those CVS directories into a
- # single archive in the directory you are running make from. The second
- # target (cvsci) will unarchive those CVS directories back where they belong.
- # The third target (cvstrim) will look for any CVS directories inside
- # directories with one of a another list of extensions (ie app, debug, profile,
- # palette, or bundle) and remove those CVS directories it finds.
-
- ######################### VARIABLE DEFINITIONS #########################
-
- # You can customize these variables to affect the behavior of the targets
-
- # The names of various programs used in this makefile
- CVS_TAR = gnutar
- CVS_ECHO = echo
- CVS_FIND = find
- CVS_RM = rm
- CVS_XARGS = xargs
-
- # The name of the CVS directories
- CVS_ADMIN_DIR = CVS
-
- # The name of the archive file to create
- CVS_ARCHIVE_FILE = CVSPackages.tar
-
- # The extensions of file-package directories from which CVS directories
- # must be archived.
- CVS_ARCHIVE_EXTS = nib rtfd
-
- # The extensions of product directories from which it is desirable to
- # trim CVS directories.
- CVS_TRIM_EXTS = debug app profile palette bundle
-
- # Aliases used for make targets can be changed to suit you
- CVS_ARCHIVE_TARGET = cvspack
- CVS_RESTORE_TARGET = cvsunpack
- CVS_TRIM_TARGET = cvstrim
-
- ######################### TARGET DEFINITIONS #########################
-
- # This will create the tar archive empty, then find all the
- # directories which match one of the CVS_ARCHIVE_EXTS extentions, and
- # append each one's CVS directory to the archive.
- $(CVS_ARCHIVE_TARGET):
- @$(CVS_RM) -f $(CVS_ARCHIVE_FILE) ; \
- $(CVS_TAR) -cf $(CVS_ARCHIVE_FILE) ; \
- $(CVS_ECHO) "Archiving CVS administrative files from directories with " ; \
- $(CVS_ECHO) " extensions $(CVS_ARCHIVE_EXTS)." ; \
- eval "findargs=\"\( \( \(\"" ; \
- eval "donefirst=\"\"" ; \
- for ext in $(CVS_TRIM_EXTS) ; do \
- if [ $$donefirst ] ; then \
- eval "findargs=\"$$findargs -o\"" ; \
- fi ; \
- eval "findargs=\"$$findargs -name \*.$$ext\"" ; \
- eval "donefirst=\"YES\"" ; \
- done ; \
- eval "findargs=\"$$findargs \) -a -type d -a -prune \) -o\"" ; \
- eval "findargs=\"$$findargs \( \(\"" ; \
- eval "donefirst=\"\"" ; \
- for ext in $(CVS_ARCHIVE_EXTS) ; do \
- if [ $$donefirst ] ; then \
- eval "findargs=\"$$findargs -o\"" ; \
- fi ; \
- eval "findargs=\"$$findargs -name \*.$$ext\"" ; \
- eval "donefirst=\"YES\"" ; \
- done ; \
- eval "findargs=\"$$findargs \) -a -type d -a -print \) \)\"" ; \
- for dir in `$(CVS_ECHO) $$findargs | $(CVS_XARGS) $(CVS_FIND) .` ; do \
- if [ -d $$dir/$(CVS_ADMIN_DIR) ] ; then \
- $(CVS_ECHO) "Archiving from $$dir." ; \
- $(CVS_TAR) -uvf $(CVS_ARCHIVE_FILE) \
- `$(CVS_FIND) $$dir -name $(CVS_ADMIN_DIR) -a \
- -type d -print` ; \
- fi ; \
- done
-
- # This just checks for the archive file, and if it's there, extracts it.
- $(CVS_RESTORE_TARGET):
- @if [ ! -f $(CVS_ARCHIVE_FILE) ] ; then \
- $(CVS_ECHO) -n "$(CVS_RESTORE_TARGET): " ; \
- $(CVS_ECHO) "Can't find $(CVS_ARCHIVE_FILE)." ; \
- exit ; \
- fi ; \
- $(CVS_ECHO) "Restoring file-package $(CVS_ADMIN_DIR) directories." ; \
- $(CVS_TAR) -xvf $(CVS_ARCHIVE_FILE) ; \
- $(CVS_RM) -f $(CVS_ARCHIVE_FILE)
-
- # This will find all the directories with one of the CVS_TRIM_EXTS
- # extentions and remove all CVS directories from them and their
- # whole sub-trees
- $(CVS_TRIM_TARGET):
- @$(CVS_ECHO) "Trimming CVS administrative files from directories with " ; \
- $(CVS_ECHO) " extensions $(CVS_TRIM_EXTS)." ; \
- eval "findargs=\"\( \(\"" ; \
- eval "donefirst=\"\"" ; \
- for ext in $(CVS_TRIM_EXTS) ; do \
- if [ $$donefirst ] ; then \
- eval "findargs=\"$$findargs -o\"" ; \
- fi ; \
- eval "findargs=\"$$findargs -name \*.$$ext\"" ; \
- eval "donefirst=\"YES\"" ; \
- done ; \
- eval "findargs=\"$$findargs \) -a -type d -a -print \)\"" ; \
- for dir in `echo $$findargs | $(CVS_XARGS) $(CVS_FIND) .` ; do \
- $(CVS_ECHO) "Trimming $$dir." ; \
- $(CVS_FIND) $$dir -name $(CVS_ADMIN_DIR) -a -type d \
- -exec $(CVS_RM) -rf {} \; -prune ; \
- done
-